import './assets/main.css';
import "@/assets/font.css";

import "@/components/toast/index.css";
import toast from "@/components/toast";

import { createApp } from 'vue';
import router from './router'
import { createPinia } from 'pinia';
import piniaPersist from 'pinia-plugin-persist';//持久化插件
import mitt from 'mitt';

import dayjs from 'dayjs';
import isLeapYear from 'dayjs/plugin/isLeapYear'; // 导入插件
import 'dayjs/locale/zh-cn'; // 导入本地化语言
dayjs.extend(isLeapYear); // 使用插件
dayjs.locale('zh-cn'); // 使用本地化语言

import { getScreenScale } from './utils';

let BASE_URL = import.meta.env.VITE_BASE_URL;
// eslint-disable-next-line no-undef
const NODE_ENV = process.env.NODE_ENV;
const env_mode = import.meta.env.MODE;
console.log(NODE_ENV, env_mode, BASE_URL)

import App from './App.vue';
const app = createApp(App);

const bus = new mitt();
app.config.globalProperties.$bus = bus;
app.config.globalProperties.$dayjs = dayjs;
app.config.globalProperties.$toast = toast;
app.config.globalProperties.$scale = getScreenScale();
//状态管理
const store = createPinia();
store.use(piniaPersist);
app.use(store);

app.use(router)

app.mount('#app')
